import { createRouter, createWebHistory } from 'vue-router'
import MainLayout from '../components/Layout.vue'
import ConsultList from '../views/ConsultList.vue'
import ConsultForm from '../views/ConsultForm.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      component: MainLayout,
      children: [
        {
          path: '',
          name: 'home',
          component: ConsultList,
        },
        {
          path: 'consult/add',
          name: 'consultAdd',
          component: ConsultForm,
        },
        {
          path: 'consult/edit/:id',
          name: 'consultEdit',
          component: ConsultForm,
        },
      ],
    },
  ],
})

export default router
